package com.algorithms;

import com.algorithms.binarytrees.BinaryTree;
import com.algorithms.utils.AlgorithmException;

public class test_tree extends Thread {
	public void run(){
		BinaryTree<Integer> bTree = new BinaryTree<Integer>(10, 10);
		bTree.insert(6, 6);
		bTree.insert(21, 21);
		bTree.insert(3, 3);
		bTree.insert(7, 7);
		bTree.insert(12, 12);
		bTree.insert(38, 38);
		bTree.insert(11, 11);
		bTree.insert(15, 15);
		bTree.insert(18, 18);
		bTree.insert(17, 17);
		
		// print original tree
		bTree.traverseLineByLine();
		System.out.println();
		
		try{
			bTree.delete(15);
		}catch(AlgorithmException alEx){
			System.err.println(alEx.getMessage());
		}
//		Object found = bTree.find(3);
//		if (found != null){
//			System.out.println(found);
//		}else{
//			System.out.println("key not found");
//		}
		//bTree.traverse();
		bTree.traverseLineByLine();
	}
	
	public static void main(String args[]){
		new test_tree().start();
	}
}
